package com.lsh.enu;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/12/16 2:06 下午
 * @desc ：
 */
public class JudgeRole {




    /**
     * 使用if/else
     * @param roleName
     * @return
     */
    public String judge1(String roleName){
        String result = "";
        if ("ROLE_ROOT_ADMIN".equals(roleName)){
            result = "ROLE_ROOT_ADMIN:"+"has AAA permission";
        }else if ("ROLE_ORDER_ADMIN".equals(roleName)){
            result = "ROLE_ORDER_ADMIN:"+"has BBB permission";
        }else if ("ROLE_NORMAL".equals(roleName)){
            result = "ROLE_NORMAL:"+"has CCC permission";
        }else {
            result = "XXX";
        }
        return result;
    }


    /**
     * 使用枚举判断
     * @param roleName
     * @return
     */
    public String judge2(String roleName){
        return RoleEnum.valueOf(roleName).op();
    }
}
